abstract class Phone {
    public double price;
    //抽象方法
    public abstract double getPrice();

    //构造方法
    public Phone(double p) {
        this.price = p;
    }
}

class Oppo extends Phone {
    @Override
    public double getPrice() {
        return this.price * 0.7;
    }

    public Oppo(double p) {
        super(p);
    }
}

class Apple extends Phone {
    @Override
    public double getPrice() {
        if (this.price >= 8000) {
            return this.price * 0.85;
        }else {
            return this.price * 0.9;
        }
    }

    public Apple(double p) {
        super(p);
    }
}

public class Test4 {
    public static void main(String[] args) {
        Phone apple1 = new Apple(3000);
        Phone apple2 = new Apple(10000);
        Phone oppo1 = new Oppo(3000);
        System.out.println(apple1.getPrice());
        System.out.println(apple2.getPrice());
        System.out.println(oppo1.getPrice());
    }
}
